#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>

int main()
{
    pid_t pid = fork();
    if (pid == 0)
    {
        char *args[] = {"ls", "-l", NULL};
        execvp("ls", args);
        perror("execvp failed"); // 若执行失败才会打印
    }
    else
    {
        wait(NULL);
        printf("Parent: Child process finished.\n");
    }
    return 0;
}